/**
 * Copyright (c) 2020 wuchenxi
 * walter-blog is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 * <p>
 * <p>
 * Mulan Permissive Software License，Version 2
 * <p>
 * Mulan Permissive Software License，Version 2 (Mulan PSL v2)
 * January 2020 http://license.coscl.org.cn/MulanPSL2
 */
package com.walter.db.mapper;

import com.walter.db.pojo.UserCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.walter.vo.category.CategoryListVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wuchenxi
 * @since 2020-12-25
 */
public interface UserCategoryMapper extends BaseMapper<UserCategory> {

    /**
     * 查询用户当前分类名个数
     *
     * @param userId
     * @param categoryName
     * @return
     */
    int countByUserIdAndCategoryName(@Param("userId") String userId, @Param("categoryName") String categoryName);

    /**
     * 查询用户下所有分类
     *
     * @param userId
     * @return
     */
    List<CategoryListVO> selectByUserId(@Param("userId") String userId);

    /**
     * 查询用户的指定分类
     *
     * @param userId
     * @param categoryId
     * @return
     */
    UserCategory selectByUserIdAndCategoryId(@Param("userId") String userId, @Param("categoryId") String categoryId);
}
